{include file="public/nheader" /}
<div class="layui-fluid layui-bg-white">
  <form action="{:url()}" class="layui-form layui-form-fixed">
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>计划名称
      </label>
      <div class="layui-input-block">
        <input name="name" type="text" required="" lay-verify="required" autocomplete="off" class="layui-input"
          value="{$row.name|default=''}" placeholder="">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>开启状态
      </label>
      <div class="layui-input-block">
        <input type="radio" name="status" lay-filter="status" value="1" {if !empty($row.status) &&
          $row.status==1}checked{/if} title="开启">
        <input type="radio" name="status" lay-filter="status" value="2" {if !empty($row.status) &&
          $row.status==2}checked{/if} title="关闭">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>跑动品牌
      </label>
      <div class="layui-input-block">
        {if !empty($pinpai) && count($pinpai) > 0}
        {foreach $pinpai as $list}
        <input type="checkbox" name="value[pbpp][]" value="{$list.type}" title="{$list.pinpai}" {if
          !empty($row['value']['pbpp']) && is_array($row['value']['pbpp']) && count($row['value']['pbpp'])> 0 &&
        in_array($list.type,$row['value']['pbpp'])}checked{/if}>
        {/foreach}
        {else}
        无
        {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>跑动来源(不选表示跑全部)
      </label>
      <div class="layui-input-block">
        {if !empty($channellist) && count($channellist) > 0}
        {foreach $channellist as $list}
        {if !empty($list)}
        <input type="checkbox" name="value[channellist][]" value="{$list}" title="{$list}" {if
          !empty($row['value']['channellist']) && is_array($row['value']['channellist']) &&
          count($row['value']['channellist'])> 0 && in_array($list,$row['value']['channellist'])}checked{/if}>
          {/if}
        {/foreach}
        {else}
        无
        {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>跑动省份(不选表示跑全部)
      </label>
      <div class="layui-input-block">
        {if !empty($provincelist) && count($provincelist) > 0}
        {foreach $provincelist as $list}
        <input type="checkbox" name="value[provincelist][]" value="{$list}" title="{$list}" {if
          !empty($row['value']['provincelist']) && is_array($row['value']['provincelist']) &&
          count($row['value']['provincelist'])> 0 &&
        in_array($list,$row['value']['provincelist'])}checked{/if}>
        {/foreach}
        {else}
        无
        {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>日有效数量
      </label>
      <div class="layui-input-block">
        <input type="number" id="value[youxiao]" name="value[youxiao]" value="{$row.value.youxiao|default='0'}"
          required="" lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>日无效数量
      </label>
      <div class="layui-input-block">
        <input type="number" id="value[wuxiao]" name="value[wuxiao]" value="{$row.value.wuxiao|default='0'}" required=""
          lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>导入日期
      </label>
      <div class="layui-input-block">
        <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
          style="width: 150px;display: inline-block;" id="value[daterangestar]" name="value[daterangestar]"
          value="{$row.value.daterangestar|default=''}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">日至
        <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
          style="width: 150px;display: inline-block;" id="daterangeend" name="value[daterangeend]"
          value="{$row.value.daterangeend|default=''}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">日
        <div style="color:red">含起始日期当天，不含结束日期当天。如果起始日期和结束日期均低于运行日期品牌自动导入功能自动关闭</div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>资源日期范围
      </label>
      <div class="layui-input-block">
        <input type="number" style="width: 150px;display: inline-block;" id="value[datebefore]" name="value[datebefore]"
          value="{$row.value.datebefore|default='0'}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">至
        <input type="number" style="width: 150px;display: inline-block;" id="value[dateafter]" name="value[dateafter]"
          value="{$row.value.dateafter|default='0'}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">天前
        <div style="color:red">如果存在一个数据是0，默认使用系统配置内数据</div>
      </div>
    </div>
    <div class="layui-footer layui-form-item layui-center ">
      <input type="hidden" value="{$row['id']|default=''}" name="id" />
      <button class="layui-btn" lay-filter="submitIframe" type="button" lay-submit>提交</button>
      <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">取消</button>
    </div>
  </form>
</div>
{include file="public/nfooter" /}
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script>
  layui.use(['form', 'jquery', 'admin', 'content'], function () {
    var form = layui.form;
    var admin = layui.admin;
    var jquery = layui.jquery;

    // 渲染富文本编辑器
    var content = layui.content;
    content.tinymce('value');
  });
</script>